package com.tjetc.output;

import org.junit.jupiter.api.Test;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

public class _6PrintStream {


    @Test
    public void testPrintStream() {
        PrintStream printStream = System.out;
        System.out.println(printStream.getClass()); // PrintStream
        printStream.println(1);
    }


    @Test
    public void testPrintStream1() throws FileNotFoundException {
        PrintStream printStream =
                new PrintStream(new FileOutputStream("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16/file/hello.txt"), true);
        printStream.println(1);

    }


    @Test
    public void testPrintStream2() throws FileNotFoundException {
        PrintStream printStream =
                new PrintStream(new FileOutputStream("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16/file/hello.txt", true), true);
        System.setOut(printStream);
        System.out.println("11111");


    }


}
